/*
 * @Author: szx
 * @Date: 2022-04-05 12:53:15
 * @LastEditTime: 2022-04-05 13:02:24
 * @Description:
 * @FilePath: \leetcode\700-799\762\762.js
 */
/**
 * @param {number} left
 * @param {number} right
 * @return {number}
 */
var countPrimeSetBits = function (left, right) {
    const isSmallPrime = (x) => {
        return x == 2 || x == 3 || x == 5 || x == 7 || x == 11 || x == 13 || x == 17 || x == 19;
    };
    const bitCount = (n) => {
        return n.toString(2).match(/1/g).length;
    };
    let res = 0;
    for (let i = left; i <= right; i++) {
        if (isSmallPrime(bitCount(i))) res++;
    }
    return res;
};
